/**
 * mongo数据库示例
 */

console.info("Mongo数据库")
let connectRet = mongo.connect("mymongodb","mongodb://172.17.0.19:27017","mydemo")
console.info(connectRet)
// 插入
// let insertRet = mongo.insertOne("mymongodb","mydemo","user",{"name":"张三"})
// console.info(insertRet)
// 查询
// let findRet = mongo.findOne("mymongodb","mydemo","user",{},{"_id":1,"name":1})
// console.info(JSON.stringify( findRet))
// 更新
// let updateRet = mongo.updateOne("mymongodb","mydemo","user",{"name":"张三"},{"$set":{"name":"俊亮"}})
// console.info(JSON.stringify( updateRet))
// 二次查询
let findRet2 = mongo.findOne("mymongodb","mydemo","user",{},{"_id":1,"name":1})
console.info(JSON.stringify( findRet2))

//删除
let deleteRet = mongo.deleteOne("mymongodb","mydemo","user",{"name":"俊亮"})
console.info(JSON.stringify( deleteRet))
service.destoryAll()